package com.zhuangjie.rider.helper;

import java.time.LocalDateTime;

/**
 * service公共业务逻辑助手
 *
 * @author zhuangjie
 * @date 2024/02/05
 */
public class ServiceHelper {
    /**
     * 判断是否为有效指定交货时间
     *
     * @param designatedDeliveryTime 指定交货时间
     * @param deliveryDuration       交货期限
     * @return boolean
     */
    public static boolean isValidDesignatedDeliveryTime(LocalDateTime designatedDeliveryTime, Integer deliveryDuration) {
        return designatedDeliveryTime != null && LocalDateTime.now().plusMinutes(deliveryDuration).isBefore(designatedDeliveryTime);
    }
}
